#include "Thread.hpp"
#include <unistd.h>
#include <vector>

using namespace ThreadModlue;

void fun()
{
}
int main()
{
    std::vector<Thread> threads;
    for (int i = 0; i < 10; i++)
    {
        threads.emplace_back([i]()
                             {
            while (true)
            {
                std::cout << "我是新线程" << i << std::endl;
                sleep(1);
            } });
    }
    sleep(5);
    for (auto &t : threads)
    {
        t.Start();
    }
    sleep(5);
    for (auto &t : threads)
    {
        t.Stop();
    }
    for (auto &t : threads)
    {
        t.Join();
    }
    // t.Start();
    //  t.Detach();
    //  t.Stop();
    // t.Join();
    return 0;
}